#ifndef EXPERIMENTEXPORTUI_H
#define EXPERIMENTEXPORTUI_H

#include <QCheckBox>
#include <QDateTime>
#include <QFileDialog>
#include <QMessageBox>
#include <QString>
#include <QWidget>
#include <QThread>

#include "ExportFileService.h"
#include "global.h"
#include "nobuttonnotice.h"
#include "PreferencesService.h"
#include "QPCRDB.h"
#include "UiStruct.h"
#include "custommessagebox.h"

namespace Ui {
class ExperimentExportUi;
}

class ExperimentExportUi : public QWidget
{
    Q_OBJECT

public:
    explicit ExperimentExportUi(QWidget *parent = nullptr);
    ~ExperimentExportUi();

private:
    Ui::ExperimentExportUi *ui;

signals:
    void previousEvent();
    void saveEvent();
    void sigExport(); // 导出信号

public:
//    void getExportData(Experiment experiment,
//                       ReactionPlate reactionPlate,
//                       ConnectedDeviceStruct device,
//                       QList<QList<QHash<QString, QString>>> saveYingguangDataList,
//                       ExportFileService *exportFileService,
//                       QHash<QHash<QString,QString>,QList<QHash<QString,QString>>> procedureList,
//                       QHash<QString, QString> targetLegend,
//                       QList<QString> ct,
//                       PreferencesService *preference);
    void getExportData();
    void renderConfigExport();
    void allComponentsInvalid();
    void allComponentsValid();

    void exportExperimentData();

    /* 获取导出初始对象 */
    void getInitObjs(PreferencesService *preference);

    void setFocusToFileNameLineEdit();/* 鼠标聚焦文字框 2023.6.2*/

public:
    ConnectedDeviceStruct device;
    CustomMessageBox *cusMsg;
    Experiment experiment;
    ExportFileService *exportFileService;
    CustomMessageBox *exportNotice;
    PreferencesService *preferencesService;
    QHash<QHash<QString,QString>,QList<QHash<QString,QString>>> procedureList;
    QHash<QString, QString> targetLegend;
    QList<QList<QHash<QString, QString>>> saveYingguangDataList; // 荧光数据列表
    QList<QList<QHash<QString, QString>>> alysYingguangDataList; // 分析后的荧光数据列表
    QList<QList<QHash<QString, QString>>> deltaYingguangDataList; // delta荧光数据列表
    QHash<QString, QString> configData;
    QList<YingGuang> saveYingguangList;
    QList<QString> exportBasicData;
    QString completeDirPath;
    QString experimentName;
    QString yingguangStringData;
    ReactionPlate reactionPlate;
    QList<QString> ct;
    QString canBi;
    QString endTime;
    QString wlkFileName;

protected:
    void showEvent(QShowEvent *event) override; // 窗口显示函数

private:
    void checkBoxChanged(QCheckBox* obj, QString item);
    void jointBasicData();
    void sleep(int msec);

};

#endif // EXPERIMENTEXPORTUI_H
